


import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:huajianshe_app/base/AppNavigator.dart';
import 'package:huajianshe_app/common/AppRouter.dart';
import 'package:huajianshe_app/common/TS.dart';
import 'package:huajianshe_app/common/load_image.dart';
import 'package:huajianshe_app/common/space.dart';
import 'package:huajianshe_app/pages/search/SearchPage.dart';
import 'package:huajianshe_app/widget/ImageWithBadge.dart';
import 'package:huajianshe_app/widget/RoundedCornerWidget.dart';

//仅首页用
class HomeSearchAppBar extends StatelessWidget {

  final void Function()? onSearch;

  const HomeSearchAppBar(this.onSearch, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(color: Colors.transparent, child:
      SafeArea(bottom: false,child: Row(mainAxisSize: MainAxisSize.max, children: [
        W(16),
        Expanded(child:
          ClipRect(child:
            BackdropFilter(filter: ImageFilter.blur(sigmaX: 19.0, sigmaY: 19.0),
                child: GestureDetector(onTap: () => search(context), child: RoundedCornerWidget(
                    backgroundColor: Color.fromRGBO(255, 255, 255, 0.4), borderColor: Colors.transparent, height: 40, radius: 13,
                    child: Row(mainAxisSize: MainAxisSize.max, children: [
                      W(16),
                      LoadImage('ic_white_search'),
                      W(12),
                      Text('Search', style: TS(16, Colors.white),)
                    ])
                ))
            )
          )
        ),
        W(0),
        ImageWithBadge('ic_white_notification', num: 1, onPressed: () {print('on press');},),
        W(10)

      ]))
    );
  }

  search(BuildContext context) {
    print('1111');
    if (this.onSearch != null)  this.onSearch!();
  }
}